package com.jhgsys.internal.dict.service;

import com.jhgsys.internal.dict.entity.Dict;
import com.jhgsys.internal.common.entity.QueryRequest;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jhgsys.internal.dict.entity.DictItem;

import java.util.List;
import java.util.Map;

/**
 * 业务字典 Service接口
 *
 * @author chenweihua
 * @date 2020-05-22 15:28:25
 */
public interface IDictService extends IService<Dict> {
    /**
     * 查询（分页）
     * @author chenweihua
     * @date 2020-05-22 15:28:25
     * @param request QueryRequest
     * @param dict dict
     * @return IPage<Dict>
     */
    IPage<Dict> findDicts(QueryRequest request, Dict dict);

    /**
     * 查询（所有）
     * @author chenweihua
     * @date 2020-05-22 15:28:25
     * @param dict dict
     * @return List<Dict>
     */
    List<Dict> findDicts(Dict dict);

    /**
    * 根据ID查询
    * @author chenweihua
    * @date 2020-05-22 15:28:25
    * @param id
    * @return Dict
    */
    Dict findDictById(String id);

    /**
     * 新增
     * @author chenweihua
     * @date 2020-05-22 15:28:25
     * @param dict dict
     */
    void createDict(Dict dict);

    /**
     * 修改
     * @author chenweihua
     * @date 2020-05-22 15:28:25
     * @param dict dict
     */
    void updateDict(Dict dict);

    /**
     * 逻辑删除
     * @author chenweihua
     * @date 2020-05-22 15:28:25
     * @param dict dict
     * @param dictIds dictIds
     */
    void deleteDict(Dict dict,String dictIds);

    /**
    * 物理删除
    * @author chenweihua
    * @date 2020-05-22 15:28:25
    * @param dictIds dictIds
    */
    void physicallyDeleteDict(String dictIds);

    List<DictItem> findDictByCode(String dictCode);

    String  findDictLabel(String dictCode,String itemCode);

    Map<String,String> findDictMapByCode(String dictCode);

    /**
     * 根据dict_code和item_code获取有效字典
     * @param itemCodes
     * @return
     */
    List<DictItem> findDictByItemCodes(String dictCode,List<String> itemCodes);
}
